<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->renameColumn('name', 'username');
            $table->string('nickname', 50)->default('')->comment('昵称');
            $table->string('telephone', 50)->default('')->comment('手机');
            $table->string('avatar', 100)->default('')->comment('头像');
            $table->tinyInteger('failure')->default(0)->comment('失败次数');
            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->uuid('uuid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->renameColumn('username', 'name');
            $table->dropColumn('nickname');
            $table->dropColumn('telephone');
            $table->dropColumn('avatar');
            $table->dropColumn('failure');
            $table->dropColumn('status');
            $table->dropColumn('uuid');
        });
    }
}
